package org.tsinghua.vaccine.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.tsinghua.core.ResultMapper;
import org.tsinghua.vaccine.service.VaccineService;

import java.util.Map;

/**
 * @author ipenta
 * @ClassName: VaccineTrackingController
 * @Description: TODO
 * @date 2017-09-20 上午9:27
 */

@Api(description = "疫苗流通信息追溯")
@RestController
@RequestMapping("/api/v1/track")
public class VaccineTrackingController {

	@Autowired
	VaccineService vaccineService;

	@ApiOperation(value = "查询接口：疫苗流通过程", notes = "疫苗流通过程查询", produces = "application/json")
	@GetMapping("/vaccine")
	@ResponseBody
	@ApiImplicitParams(value = {
			@ApiImplicitParam(paramType = "query", name = "vaccineId", required = true, dataType = "String", value = "疫苗 ID")
	})
	public Map<String, Object> query(@RequestParam String vaccineId) {

		return ResultMapper.success(vaccineService.findRecord(vaccineId));
	}
}
